#include <iostream>
#include "error.h"
#include <windows.h>

using namespace std;

//prints an error on standard output
void Error::printError(ERROR_TYPE errorType, const char *string)
{
	HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(hConsole, 'd');

	switch(errorType)
	{
		case OWN_ERROR:
			printf("%s\n", string);
			break;

		case WRONG_FILE_FORMAT:
			printf("The format of file %s is not correct\n", string);
			break;

		case IMAGE_NOT_FOUND:
			printf("Couldn't find image: %s\n", string);
			break;

		case MODEL_NOT_FOUND:
			printf("Couldn't find 3d model: %s\n", string);
			break;

		case NOT_BITMAP_FILE:
			printf("The file %s is not a bitmap file\n", string);
			break;

		case NOT_MD2_FILE:
			printf("The file %s is not a md2 file\n", string);
			break;

		case MODEL_TEXTURE_NOT_LOADED:
			printf("The 3d model (%s) texture couldn't be loaded\n", string);
			break;

		case FILE_NOT_FOUND:
			printf("The file %s was not found\n", string);
			break;

		default:
			printf("Unknown error\n");
			break;
	}

	SetConsoleTextAttribute(hConsole, 7);
}